import { putExcel, getList, deleteExcel } from "@/api/Excel"
import { AxiosResponse } from "axios"
import { Dispatch } from "redux"
import { GETLIST } from "../constant"

export const putExcelAct = async (ExcelData: unknown) => {
    const res = await putExcel(ExcelData)
    if (res.code == 1) {
        return "success"
    } else {
        return "error"
    }
}

export const getListAct = (data: PageData): any => {
    return async (dispatch: Dispatch) => {
        const res = await getList(data)
        if (res.code == 1) {
            dispatch({ type: GETLIST, data: res.data })
            return res
        } else {
            return "error"
        }
    }
}


export const deleteExcelAct = async (data: React.Key[]): Promise<AxiosResponse<any, any>> => {
    const res = await deleteExcel(data)
  
    return res
}